package org.september.pisces.settings.entity;

import org.september.smartdao.anno.AutoIncrease;
import org.september.smartdao.anno.Entity;
import org.september.smartdao.anno.Id;
import org.september.smartdao.common.BaseEntity;

import com.gitee.sunchenbin.mybatis.actable.annotation.Column;
import com.gitee.sunchenbin.mybatis.actable.annotation.IsAutoIncrement;
import com.gitee.sunchenbin.mybatis.actable.annotation.IsKey;
import com.gitee.sunchenbin.mybatis.actable.annotation.Table;

import jakarta.validation.constraints.Size;

/**
 *
 **/
@Entity
@Table("pisces_system_settings")
public class SystemSettings extends BaseEntity implements Comparable<SystemSettings>{

    /**
     *
     */
    @Id
    @AutoIncrease
    @IsKey
    @IsAutoIncrement
    @Column(name = "id", length = 20)
    private Long id;

    @Column(name = "cfg_key", comment = "配置项", isNull = false)
    private String cfgKey;

    @Column(name = "cfg_val", comment = "配置值")
    private String cfgVal;

    /**
     * 配置分组名称
     */
    @Size(max = 64)
    @Column(name = "group_name", length = 64, comment = "配置分组名称")
    private String groupName;
    
    /**
     * 标签
     */
    @Size(max = 64)
    @Column(name = "label", length = 64, comment = "标签")
    private String label;
    
    /**
     * 备注说明
     */
    @Size(max = 128)
    @Column(name = "remark", length = 128, comment = "备注")
    private String remark;

    protected transient int sortIndex;
    
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getCfgKey() {
        return cfgKey;
    }

    public void setCfgKey(String cfgKey) {
        this.cfgKey = cfgKey;
    }

    public String getCfgVal() {
        return cfgVal;
    }

    public void setCfgVal(String cfgVal) {
        this.cfgVal = cfgVal;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

	public String getGroupName() {
		return groupName;
	}

	public void setGroupName(String groupName) {
		this.groupName = groupName;
	}

	public String getLabel() {
		return label;
	}

	public void setLabel(String label) {
		this.label = label;
	}

	public int getSortIndex() {
		return sortIndex;
	}

	public void setSortIndex(int sortIndex) {
		this.sortIndex = sortIndex;
	}

	@Override
	public int compareTo(SystemSettings o) {
		if(this.sortIndex>o.getSortIndex()) {
			return 1;
		}else if(this.sortIndex<o.getSortIndex()) {
			return -1;
		}
		return 0;
	}

}
